<template>
    <div class="">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item label="用户昵称">
            <el-input v-model="formInline.user" placeholder="用户昵称"></el-input>
          </el-form-item>
          <el-form-item label="用户身份证号">
            <el-input v-model="formInline.idnumber" placeholder="用户身份证号"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSearch">查询</el-button>
          </el-form-item>
        </el-form>
        <el-button type="primary" @click="addUser($route.params.userId)">+ 新增</el-button>
        

        <!-- 使用组件 -->
        <!-- <add-user 
          :title="addUserTitle"
          :addUserVisible="addUserVisible"
          @val-change="addUser"
          @cancel="addUserVisible = false"
          ></add-user> -->

          <add-user
            :title="addUserTitle"
            :addUserVisible="addUserVisible"
            @val-change="changeAddUser"
            @cancel="addUserVisible = false"
            :modalType='modalType'
            :getList='getList'
        ></add-user>
        <!-- <add-user :addUserVisible='addUserVisible'></add-user> -->

    </div>
</template>
<script>
import addUser from '../../../components/content/useritem/addUser.vue';


import {searchUser} from '@/network/user'

export default {
    data() {
      return {
        formInline: {
          user: '',
          idnumber: ''
        },
        addUserVisible : false,
        addUserTitle:'添加用户'
      }
    },
    props:{
      modalType:Number,
      getList:Function
    },
    
    components:{
      addUser
    },
    
    methods: {
      addUser(){
        console.log('点击了新增');
        this.addUserVisible = true
        this.modalType = 0

      },
      // onSubmit() {
      //   console.log('submit!');
      //   console.log(this.$route.params);
      // },

      onSearch(){
          console.log('点击查询');
        
          let searchUser = this.formInline.user 
          let searchId = this.formInline.idnumber
          searchUser().then(res=>{
            console.log(res);
            // if(res.status !== 400){
            //   this.
            // }
          })

      },
      changeAddUser(){
        this.addUserVisible = false
      }

      // addUser(userId){
      //   console.log(userId);
       
      //   this.addUserVisible = true
       
      
      // },
      
      // addUserInfo(data){
      //   console.log(data);

      // }
    }
  }
</script>